package com.fenghen.service.impl;

import com.fenghen.config.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MQProducerService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendStockReduceMessage(Long produceId) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.STOCK_EXCHANGE, RabbitMQConfig.STOCK_ROUTING_KEY, produceId);
    }

}
